import java.io.Console;

public class checkAge {

	public static void main(String[] args) {

		Console console = System.console();

		if (console == null) {
			System.out.println("Console is not available");
			System.exit(1);
		}

		/*
		 * String[] userData; userData = new String[3];
		 * 
		 * userData[0] = console.readLine("Enter first name:"); userData[1] =
		 * console.readLine("Enter second name:"); userData[2] =
		 * console.readLine("Enter Age:"); Integer age =
		 * Integer.parseInt(userData[2]);
		 */
		
		String userFirstName = console.readLine("Enter first name:");
		String userSecondName = console.readLine("Enter second name:");
		Integer age = Integer.parseInt(console.readLine("Enter Age:"));//no validation, could use try catch

		if (age >= 40) {
			System.out.println("Welcome " + userFirstName + " "
					+ userSecondName + " I am sorry you are old");
		}
		if (age < 40) {
			System.out.println("Welcome " + userFirstName + " "
					+ userSecondName + " You are pretty young");

		}

	}
}